@extends('layouts.admin')

@section('title', '班级管理-扩展属性')
@section('style')
    <link rel="stylesheet" type="text/css" href="{{asset('lib/bootstrap/css/bootstrap.min.css')}}" />
    <link rel="stylesheet" type="text/css" href="{{asset('lib/bootstrap/css/bootstrap-combobox.css')}}" />
@endsection

@section('content')
    <article class="page-container">
        <form action="" method="post" class="form form-horizontal" id="form-techValue-add">
            <input type="hidden" value="{{$clbum_id}}" name="clbum_id">
            <ul id="Huifold2" class="Huifold">
                <li class="item">
                    <h4 class="Huifold-header">科任老师<b>+</b></h4>
                    <div class="info Huifold-body">
                        @foreach($course_teachers['data'] as $course_teacher)
                            <div class="row cl">
                                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>{{$course_teacher['system_code_value_name']}}：</label>
                                <div class="formControls col-xs-8 col-sm-9">
                                    <select class="combobox input-large form-control" name="CLBUM_EXT_COURSE_TEACHER[{{$course_teacher['system_code_value']}}]">
                                        <option value="">--请选择--</option>
                                        @foreach ($users['data'] as $user)
                                            <option value="{{$user['id']}}" @if($course_teacher['value']==$user['id']) selected="selected" @endif>{{$user['name']}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                        @endforeach
                    </div>
                </li>
                <li class="item">
                    <h4 class="Huifold-header">课代表<b>+</b></h4>
                    <div class="info Huifold-body">
                        @foreach($course_leaders['data'] as $course_leader)
                            <div class="row cl">
                                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>{{$course_leader['system_code_value_name']}}：</label>
                                <div class="formControls col-xs-8 col-sm-9">
                                    <select class="combobox input-large form-control" name="CLBUM_EXT_COURSE_LEADER[{{$course_leader['system_code_value']}}]">
                                        <option value="">--请选择--</option>
                                        @foreach ($students['data'] as $student)
                                            <option value="{{$student['id']}}" @if($course_leader['value']==$student['id']) selected="selected" @endif>{{$student['name']}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                        @endforeach
                    </div>
                </li>
                <li class="item">
                    <h4 class="selected Huifold-header">班干部<b>+</b></h4>
                    <div class="info Huifold-body">
                        @foreach($student_leaders['data'] as $student_leader)
                            <div class="row cl">
                                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>{{$student_leader['system_code_value_name']}}：</label>
                                <div class="formControls col-xs-8 col-sm-9">
                                    <select class="combobox input-large form-control" name="CLBUM_EXT_STUDENT_LEADER[{{$student_leader['system_code_value']}}]">
                                        <option value="" selected="selected">--请选择--</option>
                                        @foreach ($students['data'] as $student)
                                            <option value="{{$student['id']}}" @if($student_leader['value']==$student['id']) selected="selected" @endif>{{$student['name']}}</option>
                                        @endforeach
                                    </select>
                                </div>
                            </div>
                        @endforeach
                    </div>
                </li>
            </ul>
            <div class="row cl" style="margin-left:1px;">
               <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </form>
    </article>
@endsection
@section('script')
    <script type="text/javascript" src="{{asset('lib/bootstrap/bootstrap-combobox.js')}}"></script>
    <script>
        $("#Huifold2").Huifold();
        $('.combobox').combobox();
        $("#form-techValue-add").validate({
            rules:{
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "{{url('clbum/clbumExt/edit')}}",
                    success: function(data){
                        if(data['successFlag']==1){
                            layer_success_message("编辑成功!");
                            setTimeout(function(){
                                parent.$(".btnSearch").click();
                                layer_close();
                            },500);
                        }else{
                            layer_error_message(data['msg']);
                        }
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer_error_message('编辑失败!');
                    }
                });
            }
        });
    </script>
@endsection